﻿using System;

namespace ConsoleAppTestSever
{
    class Program
    {
        static int count = 0;
       static Weave.Server.WeaveP2Server server = new Weave.Server.WeaveP2Server();
        static void Main(string[] args)
        {
        
            server.weaveUpdateSocketListEvent += Server_weaveUpdateSocketListEvent;
            server.weaveDeleteSocketListEvent += Server_weaveDeleteSocketListEvent;
            server.waveReceiveEvent += Server_receiveevent;
            server.Start(8989);
             
           
            Console.WriteLine("8989listen:");
            while (true)
            {
                Console.ReadKey();
            }
        }
      static  int allcout = 0;
        private static void Server_weaveDeleteSocketListEvent(System.Net.Sockets.Socket soc)
        {
            count--;
            Console.WriteLine("DELETE:" + count);
        }

        private static void Server_weaveUpdateSocketListEvent(System.Net.Sockets.Socket soc)
        {
            count++;
            Console.WriteLine("UP:"+ count);
        }

        private static void Server_receiveevent(byte command, string data, System.Net.Sockets.Socket soc)
        {
           
            allcout++;
            Console.WriteLine(data+"---rece:"+ allcout+"");
            
        }
    }
}